package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsRegionMapper;
import com.qf.pojo.DtsRegion;
import com.qf.service.DtsRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @author Cc
 * @version 1.0
 */

@Service
public class DtsRegionServiceImpl implements DtsRegionService {

    @Autowired
    private DtsRegionMapper dtsRegionMapper;
    @Override
    public IPage<DtsRegion> querySelective(String name, Integer page, Integer limit, String sort, String order) {
        return dtsRegionMapper.selectPage(new Page(page,limit),
                new QueryWrapper<DtsRegion>().eq(!StringUtils.isEmpty(name),"name",name)
                        .orderBy(!StringUtils.isEmpty(sort),"ASC".equalsIgnoreCase(order),sort));
    }
}
